﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace UtopianGame.graphics.menu
{
    class HexagonButton : GraphicalObject
    {

        int regionNumber;

        public HexagonButton()
        {
        }

        public HexagonButton(ContentManager cm, int currentRegion)
        {
            init(cm, currentRegion);
        }

        protected void init(ContentManager cm, int currentRegion)
        {
            base.init(cm);
            regionNumber = currentRegion;
            if (regionNumber == 4)
            {
                spriteName = "CenterIsland";
            }
            else
            {
                spriteName = "borderIsland";
            }
            sprite = cm.Load<Texture2D>(spriteName);
            clickable = true;
            boundingBox = new Microsoft.Xna.Framework.Rectangle(15, 15, 150, 150);


        }

        public override void clicked(MouseState m)
        {
            //need to figure out how to click the different quadrants
             base.clicked(m);

            //If the mouse's coordinates are within the sprite's bounding box, then activate the menu button's code.
            if (m.X >= boundingBox.X && m.X < (boundingBox.X + boundingBox.Width) && m.Y >= boundingBox.Y && m.Y < (boundingBox.Y + boundingBox.Height))
            {
                executeFunction();
            }
        }
       
            protected virtual void executeFunction()
        {
            GlobalDataHolder.addGraphicalObject(new RegionScreen(contentManager, "regionScreen", regionNumber), 128, 32);
        }
        

        }

       
    }

